
// chartered_bus_apply_snap
export const External_chart1 = [
	{
		label: '包车车型',
		content: '',
		key: 'car_type_desc',
	},
	{
		label: '开始时间',
		content: '',
		key: 'use_start_time',
	},
	{
		label: '结束时间',
		content: '',
		key: 'use_end_time',
	},
	{
		label: '联系人',
		content: '',
		key: 'contact_name',
	},
	{
		label: '联系电话',
		content: '',
		key: 'contact_phone',
	},
	{
		label: '需求用途',
		content: '',
		key: 'demand_use',
	},
	
]

export const External_chart2 = [
	{
		label: '订单编号',
		content: '',
		key: 'sn',
	},
	{
		label: '支付状态',
		content: '',
		key: 'pay_status_desc',
	},
	{
		label: '创建时间',
		content: '',
		key: 'create_time',
	},
	{
		label: '线路产品类型',
		content: '',
		key: 'order_type_desc',
	},
	{
		label: '实付金额',
		content: '',
		key: 'order_amount',
		isMoney: true,
	},
	
]

// vehicle_scheduling_order_info
export const External_chart3 = [
	{
		label: '出车单编号',
		content: '',
		key: 'sn',
	},
	{
		label: '车牌号码',
		content: '',
		key: 'car_code',
		parent_key: 'car_snap',
	},
	{
		label: '车型信息',
		content: '',
		key: 'car_type_desc',
		parent_key: 'car_snap',
	},
	{
		label: '司机姓名',
		content: '',
		key: 'name',
		parent_key: 'driver_snap',
	},
	{
		label: '司机电话',
		content: '',
		key: 'user_info',
		parent_key: 'driver_snap',
		calling: true,
	},
	{
		label: '预计出车时间',
		content: '',
		key: 'departure_time',
	},
	{
		label: '预计完成时间',
		content: '',
		key: 'arrival_time',
	},
	{
		label: '实际出车时间',
		content: '',
		key: 'driving_time',
	},
	{
		label: '实际完成时间',
		content: '',
		key: 'done_time',
	},
	
]


export function setKeyObj(arr, res){
	for(let item of arr) {
		let {key, parent_key, isMoney, ancestor} = item
		if(parent_key){
			let The_parent = res[parent_key]
			if(The_parent) {
				let The_ancestor = The_parent[ancestor]
				if(ancestor) {
					item.content = The_ancestor[key] ? The_ancestor[key] : ''
				}
				else {
					item.content = The_parent[key] ? The_parent[key] : ''
				}
			}
		}
		else if(isMoney){
			item.content = '￥' + res[key]
		}
		else {
			item.content = res[key] ? res[key] : ''
		}
	}
	return arr
}